package my.jwds.p2038;

public class WinnerOfGame {

    public static void main(String[] args) {

        WinnerOfGame obj = new WinnerOfGame();
        long start = System.currentTimeMillis();
        System.out.println("运行时间:" + (System.currentTimeMillis() - start));
    }

    public boolean winnerOfGame(String colors) {
        int alice = 0,blob = 0,charNum = 1;
        char now = colors.charAt(0);
        colors += "C";
        for (int i = 1; i < colors.length(); i++) {
            if (colors.charAt(i) == now){
                charNum ++ ;
            }else{
                if (now == 'A') alice += charNum>2? charNum-2:0;
                if (now == 'B') blob += charNum>2? charNum-2:0;
                now = colors.charAt(i);
                charNum=1;
            }
        }
        return alice>blob;
    }
}